﻿Login = function () {

}
Login.login = function () {
    var userName = $("#username").val();
    var passWord = $("#password").val();
    var url = Editor.Url + "/login/GetAll";
    var data = {
        username: userName,
        password : passWord
    }
    $.ajax({
        url: url,
        type: "Get",
        contentType: "application/json",
        dataType: "json",
        data : data,
        cache: false,
        success: function (msg) {
            console.dir(msg);
            console.log(msg.username);            
            if (msg.userid != -1) {
                Editor.Save(msg, "login");
                location.href = Editor.Url;
            }
        },
        error: function (err) {
            // When Service call fails
        }
    });
}
Login.logout = function () {

}
$(document).ready(function () {
    $("#btnlogin").click(function () {
        Login.login();
    });
});